<?php 
/**
 * 
 * Modelo de key de controe de entrada
 * @author natanael
 * 
 */
class mkey  extends Model{
	
	private $mNameTable = "GW_Crypt";
	
	public function __construct(){
		parent::Model();
		$this->load->database();
	}
	
    public function loadById() 
    {
		  $qresult = $this->db->get_where($this->mNameTable,array('ID' => 1));		
		  if ($qresult->num_rows() == 0)
		  {
			 return false;
		  }	

			return new modelo_key($qresult->row());
	 }
	 
	 public function updateKey($doc)
	 {
	 	if ($this->db->update($this->mNameTable, array('Detalle'=>$doc),array('ID'=>1))) {	
	 		  	
	 		return true;
	 	}
	 	
	 	 return false;

	 	
	 }
	
}

class modelo_key{
	
	private $id;
	private $descriccion;
	
	public function __construct($ojt)
	{
		$this->setId($ojt->ID);
		$this->setDescriccion($ojt->Detalle);
	}
	
	public function getId(){
		return $this->id;
	}
	
	public function setId($ojt){
	     $this->id = $ojt;	
	}
	
	public function getDescriccion(){
		return $this->descriccion;
	}
	
	public function setDescriccion($ojt){	
		$this->descriccion = $ojt;
	}
	
}

?>